<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "appendix".
 *
 * @property string $FJDM 附件代码
 * @property int $SXM 顺序码
 * @property string $WJM 文件名
 * @property string $WJLJ 文件路径
 * @property int $WJDX 文件大小
 * @property string $CJSJ 创建时间
 * @property string|null $GXSJ 更新时间
 *
 * @property StudentStatus $studentStatus
 */
class Appendix extends \yii\db\ActiveRecord
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'appendix';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['FJDM', 'SXM', 'WJM', 'WJLJ', 'WJDX', 'CJSJ'], 'required'],
            [['SXM', 'WJDX'], 'integer'],
            [['CJSJ', 'GXSJ'], 'safe'],
            [['FJDM', 'WJM'], 'string', 'max' => 50],
            [['WJLJ'], 'string', 'max' => 100],
            [['FJDM', 'SXM'], 'unique', 'targetAttribute' => ['FJDM', 'SXM']],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'FJDM' => '附件代码',
            'SXM' => '顺序码',
            'WJM' => '文件名',
            'WJLJ' => '文件路径',
            'WJDX' => '文件大小',
            'CJSJ' => '创建时间',
            'GXSJ' => '更新时间',
        ];
    }

    /**
     * Gets query for [[StudentStatus]].
     *
     * @return \yii\db\ActiveQuery
     */
    public function getStudentStatus()
    {
        return $this->hasOne(StudentStatus::className(), ['FJDM' => 'FJDM'])->inverseOf('fJDM');
    }
}
